package com.amox.uitest.adapter;

import org.dom4j.Element;

import com.amox.uitest.common.KeyWord;
import com.amox.uitest.kit.LogKit;
import com.amox.uitest.tcase.BaseTestCase;

import ognl.Ognl;

public class IfAdapter extends BaseAdapter<Boolean> {

	public IfAdapter(BaseTestCase uitest) {
		super(uitest);
	}

	@Override
	public Boolean adapter(Element element) throws Exception {
		String test = element.attributeValue(KeyWord.test.name());
		// likeBtn.isSelected()
		Object obj = Ognl.getValue(test, BaseTestCase.context, BaseTestCase.context.getRoot());
		
		LogKit.printLog(test + " = " + obj);
		
		return (Boolean)obj;
		
//		if((Boolean)obj) {
//			return funcAdapter.play(element); 
//		} else {
//			return false;
//		}
		
	}
	
}
